﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FreesenseSubAIS
{
    public  class CommunicationTest
    {
        public delegate void APIStartInspEventHandler();
        public static event APIStartInspEventHandler apistart;
        public static Stand Sd1 = new Stand("stand1");//平台1
        public static Stand Sd2 = new Stand("stand2");//平台2
        public static Stand Sd3 = new Stand("stand3");//平台3
        public static Stand Sd4 = new Stand("stand4");//平台4
        private static StandWorkingState WS=StandWorkingState .none ;//检测机构状态
        public static StandWorkingState InspWorkingState
        {
            get
            {
                return WS;
            }
            set
            {
                if (value != WS)
                {
                    WS = value;
                    if (value == StandWorkingState.ready)
                    {
                        //API do work
                        apistart();
                    }
                }
            }
        }
       
    }
    public enum StandWorkingState
    {
        ready = 0,//读取到触发检测
        working,//检测开始置为working
        finished,//检测完成置为finished
        none//下料置为none
    }
    public  class Stand
    {
        public string StandName;//平台名
        //public int StandNumber;//平台号
        public bool StandState;//有无料,true表示有料，false，表示无料
        public StandInspResult StandResult;//检测结果
        public Stand(string name)
        {
            this.StandName = name;
        }
    }
    public enum StandInspResult
    {
        pass = 0,//检测OK
        failed,//检测NG
        none//无料
    }
    public class APIResult
    {
        public string StandID;//平台ID
        public StandInspResult Result;//检测结果
        public APIResult(string id)
        {
            StandID = id;
        }
    }
}
